package com.hzw.saas.service.workspace.util;

import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * <p>
 *
 * </p>
 *
 * @author sonam
 * @since 2021/6/9 15:45
 */
public class SocketUtil {

    public static boolean telnet(String host, int port) {
        Socket socket = new Socket();
        try {
            socket.connect(new InetSocketAddress(host, port));
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        } finally {
            try {
                socket.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return true;
    }

}
